package com.guys8.cemsbackend.DTO;

import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.guys8.cemsbackend.entity.Outschool;
import com.guys8.cemsbackend.entity.User;
import com.guys8.cemsbackend.utils.UploadUtil.UploadUtil;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.util.Date;

/**
 * (Outschool)表实体类
 *
 * @author breeze
 * @since 2022-08-24 16:11:31
 */
@Setter
@Getter
@ToString
public class OutschoolInformation extends Model<OutschoolInformation> {

    //private UserInformation userInformation;
    private Date upTime;
    private Date outTime;
    private String outCause;
    private String wplace;
    private Date backTime;
    //假条图片地址
    private String notePath;
    //0-审核中，1-通过，2-不通过
    private Integer auditState;
    private Date auditTime;
    private Integer auditAccount;
    private byte[] note;

    public OutschoolInformation(){}
    public OutschoolInformation(User user, Outschool outschool){
        //setUserInformation(new UserInformation(user));
        setUpTime(outschool.getUpTime());
        setOutTime(outschool.getOutTime());
        setOutCause(outschool.getOutCause());
        setWplace(outschool.getWplace());
        setNotePath(outschool.getNotePath());
        setBackTime(outschool.getBackTime());
        setAuditState(outschool.getAuditState());
        setAuditTime(outschool.getAuditTime());
        setAuditAccount(outschool.getAuditAccount());
        try {
            setNote(UploadUtil.getnotefile(notePath+"/"+outschool.getOutId()+".jpg"));
        } catch (IOException e) {
            e.printStackTrace();
        }
    }


}

